<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ViewTecnicoTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">            

            <p:growl id="messages" life="3000"/>

            <h:panelGroup id="messagePanel" styleClass="ajustaListaMensagemErro"  layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="list"/>
            </h:panelGroup>

            <p:panel>

                <f:facet name="header">
                    <h:outputText value="#{bundle.LegendTecnicoTitle}"></h:outputText>
                </f:facet>

                <h:panelGrid columns="2">
                    <h:outputText value="#{bundle.ViewTecnicoLabel_tecId}"/>
                    <h:outputText value="#{tecnicoController.selected.tecId}" title="#{bundle.ViewTecnicoTitle_tecId}"/>
                    <h:outputText value="#{bundle.ViewTecnicoLabel_tecNm}"/>
                    <h:outputText value="#{tecnicoController.selected.tecNm}" title="#{bundle.ViewTecnicoTitle_tecNm}"/>
                    <h:outputText value="#{bundle.ViewTecnicoLabel_tecEmail}"/>
                    <h:outputText value="#{tecnicoController.selected.tecEmail}" title="#{bundle.ViewTecnicoTitle_tecEmail}"/>
                    <h:outputText value="#{bundle.ViewTecnicoLabel_tecTelefone}"/>
                    <h:outputText value="#{tecnicoController.selected.tecTelefone}" converter="inputConverter" title="#{bundle.ViewTecnicoTitle_tecTelefone}"/>
                    <h:outputText value="#{bundle.ViewTecnicoLabel_tecTelefone2}"/>
                    <h:outputText value="#{tecnicoController.selected.tecTelefone2}" converter="inputConverter" title="#{bundle.ViewTecnicoTitle_tecTelefone2}"/>

                    <h:outputLabel value="#{bundle.EditTecnicoLabel_tecUsina}"/>                 
                    <p:dataList id="dataListUsinas" value="#{tecnicoController.usinasList}" var="item" paginator="true" 
                                currentPageReportTemplate="#{bundle.currentPageReportTemplateUsina}" 
                                paginatorPosition="bottom" rows="15" rowsPerPageTemplate="15,30,60" type="none" 
                                paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink} {RowsPerPageDropdown}">

                        <h:outputText value="#{item.usiTpuId.tpuNm} #{item.usiNm} (#{item.orgao.orgNm})" style="margin-left:10px" />                        
                        <br />
                    </p:dataList>
                    <h:outputLabel value="#{bundle.createBy}" for="nomeCriador" rendered="#{tecnicoController.selected.historicoCriacao.nomeUsuario != null}"/>
                    <h:outputText id="nomeCriador" value="#{tecnicoController.selected.historicoCriacao.nomeUsuario}" rendered="#{tecnicoController.selected.historicoCriacao.nomeUsuario != null}"/>
                    <h:outputLabel value="#{bundle.createDate}" for="dataCriacao" rendered="#{tecnicoController.selected.historicoCriacao.dataHora != null}"/>
                    <h:outputText id="dataCriacao" value="#{tecnicoController.selected.historicoCriacao.dataHora}" rendered="#{tecnicoController.selected.historicoCriacao.dataHora != null}"/>     
                    <h:outputLabel value="#{bundle.updateBy}" for="nomeAlterador" rendered="#{tecnicoController.selected.historicoAlteracao.nomeUsuario != null}"/>
                    <h:outputText id="nomeAlterador" value="#{tecnicoController.selected.historicoAlteracao.nomeUsuario}" rendered="#{tecnicoController.selected.historicoAlteracao.nomeUsuario != null}"/>
                    <h:outputLabel value="#{bundle.updateDate}" for="dataAlteracao" rendered="#{tecnicoController.selected.historicoAlteracao.dataHora != null}"/>
                    <h:outputText id="dataAlteracao" value="#{tecnicoController.selected.historicoAlteracao.dataHora}" rendered="#{tecnicoController.selected.historicoAlteracao.dataHora != null}" /> 
                </h:panelGrid>

                <br />
                <p:commandButton id="deleteCommand" rendered="#{autenticadorController.loginAdmin}" onclick="confirmationDestroy.show()" value="#{bundle.ViewTecnicoDestroyLink}" type="button" icon="#{bundle.icone_lixeira}" />&nbsp;
                <p:commandButton ajax="false" rendered="#{!autenticadorController.loginVisualizador}" icon="#{bundle.icone_pencil}" action="Edit" value="#{bundle.ViewTecnicoEditLink}"/> &nbsp;
                <p:commandButton ajax="false" action="#{tecnicoController.prepareList}" icon="#{bundle.icone_listar}" value="#{bundle.ViewTecnicoShowAllLink}"/>
            </p:panel>

            <p:confirmDialog id="confirmDestroy" message="#{bundle.MsgConfirmDestroy_message}" header="#{bundle.MsgConfirmDestroy_header}" severity="alert" widgetVar="confirmationDestroy">
                <p:commandButton id="confirm" ajax="false" value="#{bundle.MsgDialog_confirmar}"  oncomplete="confirmationDestroy.hide();" action="#{tecnicoController.destroy}" />
                <p:commandButton id="decline" value="#{bundle.MsgDialog_cancelar}" update="messages" onclick="confirmationDestroy.hide()" type="button"/>
            </p:confirmDialog>

        </ui:define>
    </ui:composition>

</html>
